﻿var partners, departments;
var textEditorInitialize = function (container, options) {
    $('<textarea name="' + options.field + '" style="width: 92%;height:100px" />')
            .appendTo(container);
};

var textAutocompleteInitialize = function (container, options) {
    $('<input name="' + options.field + '" class="txt-autocomplete" />')
            .appendTo(container);
    $(".txt-autocomplete").kendoAutoComplete({
        dataSource: partners,
        filter: "contains",
        placeholder: "Chọn đối tác",
        separator: ", ",
        highlightFirst: true
    });
};

function gridDropDownEditor(container, options) {
    $("<input />")
    .attr("data-bind", "value:DepartmentID")
    .appendTo(container)
    .kendoComboBox({
                dataTextField: "Ten",
                dataValueField: "ID",
                dataSource: departmentss,
                filter: "contains",
                width:"100px",
                suggest: true
            });
}

function getDepartmentsName(MaPhong) {
    var TenDoiTac = " ";
    $.each(departmentss, function () {
        if (this.ID == MaPhong) {
            TenDoiTac = this.Ten;
            return false;
        }
    });
    return TenDoiTac;
}

var columndatepicker = function (container, options) {
    $('<input name="' + options.field + '" class="txt-datetimepicker" />')
            .appendTo(container);
    $(".txt-datetimepicker").kendoDatePicker({
        format: "dd/MM/yyyy"
    });
};

var gridcolumneditor = function (container, options) {
    $('<input name="' + options.field + '" class="txt-editor" />')
            .appendTo(container);

    $(".txt-editor").kendoEditor({ tools: [] });
};
